package editor.cn;
class Solution1035{
    public static void main(String[] args) {
        Solution solution = new Solution1035().new Solution();
    }
    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        //这一题不就是和最长公共子序列一个题目吗！！！注意了，代码都一样的，就是一比一得翻译
        public int maxUncrossedLines(int[] s, int[] t) {
            int n = s.length;
            int m = t.length;
            int[][] f = new int[n + 1][m + 1];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    f[i + 1][j + 1] = s[i] == t[j] ? f[i][j] + 1 :
                            Math.max(f[i][j + 1], f[i + 1][j]);
                }
            }
            return f[n][m];
        }
    }

//leetcode submit region end(Prohibit modification and deletion)

}